package com.pwt.config;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.SchedulingConfigurer;
import org.springframework.scheduling.config.ScheduledTaskRegistrar;

import java.util.concurrent.Executors;

/**
 * @author dw
 * @date 2022/1/19 15:00
 * @Description
 */
@Configuration
public class SchedulerConfig implements SchedulingConfigurer {

    private Logger logger = LoggerFactory.getLogger(SchedulerConfig.class);

    @Override
    public void configureTasks(ScheduledTaskRegistrar scheduledTaskRegistrar) {
        logger.info("定时任务配置10个线程！");
        scheduledTaskRegistrar.setScheduler(Executors.newScheduledThreadPool(10));
    }
}
